package cn.edu.svtcc.config;

import cn.edu.svtcc.domain.Grade;
import cn.edu.svtcc.domain.Student;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.DoubleStream;

@Component
@ConfigurationProperties(prefix = "students") // 绑定 students 前缀
public class StudentConfig {
    // 学生列表
    private List<Student> list = new ArrayList<>();

    // 成绩列表（对应 students.grades.list）
    private Grades grades = new Grades(); // 内嵌类

    // 学生列表的 Getter & Setter
    public List<Student> getList() { return list; }
    public void setList(List<Student> list) { this.list = list; }

    // 成绩列表的 Getter & Setter
    public Grades getGrades() { return grades; }
    public void setGrades(Grades grades) { this.grades = grades; }

    // 内嵌类定义
    public static class Grades {
        private List<Grade> list = new ArrayList<>();

        public List<Grade> getList() { return list; }
        public void setList(List<Grade> list) { this.list = list; }


    }
}
